package com.lemon.smartsafety.entity.event.http;

import com.lemon.smartsafety.app.AppService;
import com.lemon.smartsafety.entity.event.base.AppEvent;
import com.lemon.smartsafety.http.callback.HandlerCallback;

/**
 * Created by Cooliean on 16/1/20.
 */
public class HttpCallbackEvent<T> extends AppEvent {
    private T obj;
    private String msg;
    private Object other;
    private float progress;
    private int code = -1;

    private HandlerCallback.HttpFlow httpFlow;


    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }


    public String getMsg() {
        return msg == null ? "未知提示" : msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public float getProgress() {
        return progress;
    }

    public void setProgress(float progress) {
        this.progress = progress;
    }

    public HandlerCallback.HttpFlow getHttpFlow() {
        return httpFlow;
    }

    public void setHttpFlow(HandlerCallback.HttpFlow httpFlow) {
        this.httpFlow = httpFlow;
    }

    public Object getOther() {
        return other;
    }

    public void setOther(Object other) {
        this.other = other;
    }

    public String toString(){
        return AppService.getGson().toJson(this);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
